<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="{{asset('css/materialize.css')}}">
    <style>
        a{ margin: 10px;}
        .main{ margin-top: 100px;}
        .error{ color: red;}
        .save,.cancel{ margin-top: 15px; margin-bottom: 50px;}
    </style>
</head>
<body>
<div class="container">
    <div class="header">
        <nav>
            <div class="nav-wrapper teal lighten-1">
                <a href="#" class="brand-logo center">留言列表</a>
            </div>
        </nav>
        {{--<input type="text"><a href="/content/create" class="waves-effect waves-light btn right">留言</a>--}}
        {{--<a href="" class="btn btn-primary">新增留言</a>--}}
    </div>
    <div class="main">
        <form action="{{url('content')}}" method="post" enctype="multipart/form-data">
            {{ csrf_field() }}
            <div class="form-group">
                <label for="">新增留言：</label>
                <input type="text" name="data" class="form-control">
                {{--<span class="error"></span>--}}
                @foreach($errors->get('data') as $error)
                    <p class="error">{{$error}}</p>
                @endforeach

                <input type="file" name="photo" class="file">
                @foreach($errors->get('photo') as $error)
                    <p class="error">{{$error}}</p>
                @endforeach
            </div>
            <button class="btn btn-primary save">保存</button>
            <a class="btn btn-danger cancel">取消</a>
        </form>
        @foreach($contents as $c)
            <div>
                <a href="">{{$c->data}}</a>
                <img src="{{$c->photo}}" alt="" width="100" height="100">
                <a href="{{url('content/'.$c->id.'')}}" class="waves-effect waves-light btn">修改</a>
                <a href="{{url('content/delete/'.$c->id.'')}}" class="waves-effect waves-light btn red lighten-2">删除</a>
            </div>
        @endforeach
    </div>
</div>
</body>
</html>